#include "adder2.h"

ShowTime::ShowTime()
{
	/* 成员变量初始化，并将其挂靠到父窗口this */
	label = new QLabel(this);
	btn = new QPushButton("getTime",this);

	/* 调整成员变量位置 */
	this->resize(500,300);
	label->resize(100,100);
	label->move(250,100);
	btn->move(250,200);
	QObject::connect(btn, SIGNAL(clicked()),
		this,  SLOT(getTime()));	
};

ShowTime::~ShowTime()
{
	delete(label);
	delete(btn);
};

void ShowTime::getTime()
{
	/* 获取当前时间 */
	QString timestr = QTime::currentTime().toString("H:m:s a");
	label->setText(timestr);
};
